package micro.controller.userMeun;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import micro.pojo.employees;
import micro.pojo.hr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
@Controller
@RequestMapping("/nv")
public class userMenu08 {
    @Autowired
    private micro.service.userMeun.userspace userspace;
    @ResponseBody
    @RequestMapping(value = "/ofd",produces = "text/plain;charset=utf-8",method = RequestMethod.POST)
    public String getMemberById(@RequestParam("id") Integer id,@RequestParam("email") String email, @RequestParam("phone") String phone,@RequestParam("address") String address)
    {
        System.out.println("修改进入");
        System.out.println(id);
            employees employees=new employees();
            employees.setId(id);
            employees.setEmail(email);
            employees.setPhone(phone);
            employees.setAddress(address);
            int i=userspace.upen(employees);
        JSONObject result = new JSONObject();
        if(i>0) {
            System.out.println("修改成功");
            System.out.println(employees.getName());
            result.put("status", "success");
        }
        else
        { result.put("status", "fail");
        }
        return result.toJSONString();
    }
}

